package com.picvik.action;

import javax.print.attribute.standard.Media;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.picvik.model.DeleteMediaModel;

public class DeleteAction extends ActionSupport {
	private String mediatype;
	private Integer mediaid;
	
	public String getMediatype() {
		return mediatype;
	}

	public void setMediatype(String mediatype) {
		this.mediatype = mediatype;
	}

	public Integer getMediaid() {
		return mediaid;
	}

	public void setMediaid(Integer mediaid) {
		this.mediaid = mediaid;
	}

	public String deleteMedia() {
		System.out.println(mediatype);
		System.out.println(mediaid);
		String tblname = null;
		String clause = null;
		switch(mediatype) {
		case "album":
			tblname = "picvik_picture_album";
			clause = "albumid";
			break;
		case "picture":
			tblname = "picvik_picture";
			clause = "pictureid";
			break;
		case "channel":
			tblname = "picvik_video_channel";
			clause = "channelid";
			break;
		case "video":
			tblname = "picvik_video";
			clause = "videoid";
			break;
		}
		
		DeleteMediaModel dmm = new DeleteMediaModel();
		dmm.deleteMedia(tblname, clause, mediaid);
		return SUCCESS;
	}

}
